<?php
class CKEDITOR extends CI_Controller {
	public static function createEditor($id = 'content', $width='960px', $height='380px') {
		//Ckeditor's configuration
		$editor = array (
			//ID of the textarea that will be replaced
			'id' => $id, 'path' => 'tools/ckeditor', 
			//Optionnal values
			'config' => array ('toolbar' => "Full", //Using the Full toolbar
								'width' => $width, //Setting a custom width
								'filebrowserBrowseUrl' => base_url().'tools/ckfinder/ckfinder.html',
								'filebrowserImageBrowseUrl' => base_url(). 'tools/ckfinder/ckfinder.html?Type=Images',
								'filebrowserFlashBrowseUrl' => base_url(). 'tools/ckfinder/ckfinder.html?Type=Flash',				
								'filebrowserUploadUrl' => base_url(). 'tools/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',				
								'filebrowserImageUploadUrl' => base_url(). 'tools/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
								'filebrowserFlashUploadUrl' => base_url(). 'tools/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash',
								'height' => $height ),//Setting a custom height
			//Replacing styles from the "Styles tool"
			'styles' => array (
			//Creating a new style named "style 1"
			'style 1' => array ('name' => 'Blue Title', 'element' => 'h2',
								'styles' => array ('color' => 'Blue', 'font-weight' => 'bold' ) ), 
	
			//Creating a new style named "style 2"
			'style 2' => array ('name' => 'Red Title', 'element' => 'h2', 
								'styles' => array ('color' => 'Red', 'font-weight' => 'bold', 'text-decoration' => 'underline' ) ) ) );
		return $editor;
	}
}
